<?php

require_once dirname(__FILE__).'/../lib/bulletin_board_commentGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/bulletin_board_commentGeneratorHelper.class.php';

/**
 * bulletin_board_comment actions.
 *
 * @package    ecollegeplus
 * @subpackage bulletin_board_comment
 * @author     Batanayi Matuku
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class bulletin_board_commentActions extends autoBulletin_board_commentActions
{

    public function executeCreate(sfWebRequest $request)
    {
        $this->form = $this->configuration->getForm();
        $this->bulletin_board_comment = $this->form->getObject();

        $this->processForm($request, $this->form);
    }

    protected function processForm(sfWebRequest $request, sfForm $form)
    {
        $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
        if ($form->isValid())
        {
            $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';

            try
            {
                $this->bulletin_board_comment = $form->save();
            }
            catch (Doctrine_Validator_Exception $e)
            {
                
            }

            $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $this->bulletin_board_comment)));
        }
        else
        {
            $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
        }
    }
}
